package com.hmall.user.utils;

/**
 * ThreadLocal工具类
 *
 * @Author Eeyore
 * @Date 2022/8/12 17:47
 * @Description: ThreadLocal工具类
 */

public class UserHolder {
    private static final ThreadLocal<Long> tl = new ThreadLocal<>();

    public static void setUser(Long userId) {
        tl.set(userId);
    }

    public static Long getUser() {
        return tl.get();
    }

    public static void remove() {
        tl.remove();
    }
}